package com.jiandian.controller;

import com.jiandian.util.BaseController;
import com.jiandian.util.BaseResult;
import com.jiandian.util.Constants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@ControllerAdvice
@RestController
public class ErrorHandler extends BaseController {
    @ExceptionHandler(Exception.class)
    public BaseResult errorHandler(Exception e){
        log.error(e.getMessage());
        return sendResult(Constants.RESPONSE_CODE_400,Constants.RESPONSE_MESSAGE_400,"");
    }
}
